package message.api.sms.vo;

import java.io.Serializable;
import java.util.Date;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by xiaoqian on 2016/10/25.
 */
public class SmsReq implements Serializable {

    /**
     * 短信提供商，只定用哪个短信服务发送
     */
    private String smsProvider;

    /**
     * 业务数据项
     */
    private String businessData;

    /**
     * 收件人
     */
    private List<String> tos;

    /**
     * 内容
     */
    private String content;

    /**
     * 短信签名
     */
    private String signName;

    /**
     * 根据模块发送邮件
     */
    public String templateCode;

    /**
     * 模板参数
     */
    public Map<String,Object> templateParams = new LinkedHashMap<>();


    /**
     * 当指定发送时间，如果是过去的时间，立刻发送，如果不是，送到后台定时发送
     */
    public Date sendTime;

    public String getBusinessData() {
        return businessData;
    }

    public void setBusinessData(String businessData) {
        this.businessData = businessData;
    }

    public String getSignName() {
        return signName;
    }

    public void setSignName(String signName) {
        this.signName = signName;
    }

    public String getSmsProvider() {
        return smsProvider;
    }

    public void setSmsProvider(String smsProvider) {
        this.smsProvider = smsProvider;
    }

    public List<String> getTos() {
        return tos;
    }

    public String getTosStr(){
        StringBuilder stringBuilder = new StringBuilder();
        for (String to : tos) {
            stringBuilder.append(to+",");
        }
        String str = stringBuilder.toString();
        if(str.endsWith(",")){
            return str.substring(0,str.length()-1);
        }else{
            return str;
        }
    }

    public void setTos(List<String> tos) {
        this.tos = tos;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getTemplateCode() {
        return templateCode;
    }

    public void setTemplateCode(String templateCode) {
        this.templateCode = templateCode;
    }

    public Map<String, Object> getTemplateParams() {
        return templateParams;
    }

    public void setTemplateParams(Map<String, Object> templateParams) {
        this.templateParams = templateParams;
    }

    public Date getSendTime() {
        return sendTime;
    }

    public void setSendTime(Date sendTime) {
        this.sendTime = sendTime;
    }

    @Override
    public String toString() {
        return "SmsReq{" +
                "smsProvider='" + smsProvider + '\'' +
                ", businessData='" + businessData + '\'' +
                ", tos=" + tos +
                ", content='" + content + '\'' +
                ", signName='" + signName + '\'' +
                ", templateCode='" + templateCode + '\'' +
                ", templateParams=" + templateParams +
                ", sendTime=" + sendTime +
                '}';
    }
}